<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:pt="http://xmlns.jcp.org/jsf/passthrough"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
    <h:head>
        <title>iNET- Tiện ích văn phòng</title>
        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
        <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
        <link rel="shortcut icon" href="TienIchVanPhong/resources/images/logo.png" />
        <h:outputStylesheet library="css" name="menu.css"/>
        <h:outputStylesheet library="css" name="style.css"/>
        <h:outputStylesheet library="css" name="BeatPicker.min.css"/>
        <h:outputScript library="js" name="jquery-1.11.0.min.js"/>
        <h:outputScript library="js" name="BeatPicker.min.js"/>

    </h:head>
    <h:body>
        <h:form id="frmAdd">

            <!--Start header-->
            <ui:include src="/resources/template/header.xhtml"/>
            <!--end header-->

            <div class="main">
                <!-- Menu left-->

                <ui:include src="/resources/template/left.xhtml"/>

                <!--end menu left-->

                <!--nội dung-->

                <div class="right"> <br/>
                    <p align="center"><b>THÊM NHÂN VIÊN MỚI</b></p>
                    <div class="controll">
                        <p align="center" style="margin: 10px;color: red"> <h:messages  style="color: red;list-style: none;text-align: center"/> </p>
                        <table style="margin: 0 auto;">

                            <tr>
                                <td>
                                    <table class="tblemp" >
                                        <tr>
                                            <td colspan="3">
                                                <p style="margin: 10px" align="center"><b>Thông tin nhân viên</b></p>  
                                            </td>  

                                        </tr>
                                        <tr>
                                            <td class="rowemp">Mã nhân viên:</td>
                                            <td class="rowemp1">
                                                <h:inputText value="#{employeeController.emp.emp_code}" class="inputadd" id="manv" title="Phải nhập từ 6-20 ký tự" pt:pattern="[0-9A-Za-z]{6,20}"  pt:placeholder="Mã nhân viên" pt:required=""/>
                                            </td>
                                            <td class="rowemp2">(*)</td>
                                        </tr>
                                        <tr>
                                            <td class="rowemp">Họ và tên đệm:</td>
                                            <td class="rowemp1">
                                                <h:inputText value="#{employeeController.emp.first_name}" class="inputadd" id="honv" title="Không được dùng sô và ký tự đặc biệt"
                                                             pt:pattern="[^0-9\\~\\!\\@\\#\\$\\%\\^\\*\\(\\)\\-\\_\\=\\+\\.\\,\\/\\?\\'\\:\\;\\>]{2,50}" 
                                                             pt:placeholder="Họ và tên đệm" pt:required=""/>
                                            </td>
                                            <td class="rowemp2">(*)</td>
                                        </tr>
                                        <tr>
                                            <td class="rowemp">Tên :</td>
                                            <td class="rowemp1">
                                                <h:inputText value="#{employeeController.emp.last_name}" class="inputadd" id="tennv" title="Không được dùng số và ký tự đặc biệt" 
                                                             pt:pattern="[^0-9\\~\\!\\@\\#\\$\\%\\^\\*\\(\\)\\-\\_\\=\\+\\.\\,\\/\\?\\'\\:\\;\\>]{2,50}" 
                                                             pt:placeholder="Tên nhân viên" pt:required=""/>
                                            </td>
                                            <td class="rowemp2">(*)</td>
                                        </tr>                                        
                                        <tr>
                                            <td class="rowemp">Số điện thoại:</td>
                                            <td class="rowemp1">
                                                <h:inputText value="#{employeeController.emp.emp_mobile}" class="inputadd" id="sdt" pt:placeholder="Số điện thoại" 
                                                             title="Số điện thoại không đúng định dạng- VD: 09*********"
                                                             pt:pattern="[0]+[1-9]{9,10}"
                                                             pt:required=""/>
                                            </td>
                                            <td class="rowemp2">(*)</td>
                                        </tr>
                                        <tr>
                                            <td class="rowemp">Email:</td>
                                            <td class="rowemp1">
                                                <h:inputText value="#{employeeController.emp.emp_email}" class="inputadd" id="email" pt:type="email" pt:placeholder="Email" pt:required=""
                                                             pt:pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,3}$"
                                                             title="VD:inet@inet.vn"
                                                             />
                                            </td>
                                            <td class="rowemp2">(*)</td>
                                        </tr>
                                        <tr>
                                            <td class="rowemp">Địa chỉ:</td>
                                            <td class="rowemp1">
                                                <h:inputText value="#{employeeController.emp.address}" class="inputadd" id="diachi" pt:placeholder="Địa chỉ" 
                                                             pt:required=""/>
                                            </td>
                                            <td class="rowemp2">(*)</td>
                                        </tr>
                                        <tr>
                                            <td class="rowemp">Ngày sinh:</td>
                                            <td class="rowemp1">


                                                 <h:inputText class="inputadd" value="#{employeeController.emp.emp_dob}" id="ngaysinh" pt:placeholder="Ngày sinh" 
                                                             pt:required=""
                                                             pt:data-beatpicker="true" 
                                                             pt:data-beatpicker-position="['right','bottom']"
                                                             pt:data-beatpicker-format="['DD','MM','YYYY']" 
                                                             pt:data-beatpicker-module="clear"
                                                             pt:data-beatpicker-extra="customOptions"
                                                             
                                                             >
                                                    <f:convertDateTime pattern="dd-MM-yyyy" ></f:convertDateTime>
                                                </h:inputText>
                                                <script type="text/javascript">
                                                    customOptions = {
                                                        labels: {
                                                            today: "Hôm nay",
                                                            gotoDateInput: "",
                                                            gotoDateButton: "Đến",
                                                        }
                                                    }
                                                </script>
                                            </td>
                                            <td class="rowemp2">(*)</td>
                                        </tr>
                                        <tr>
                                            <td class="rowemp">Nơi sinh:</td>
                                            <td class="rowemp1">
                                                <h:selectOneMenu value="${employeeController.emp.birth_place}" id="noisinh" class="chonadd" pt:required="" >                                                 
                                                    <f:selectItem itemValue="" itemLabel="---Chọn một thành phố---"/> 
                                                    <f:selectItems value="#{constantsController.city}" var="c" itemValue="#{c}" itemLabel="#{c}" />                                           
                                                </h:selectOneMenu>
                                            </td>
                                            <td class="rowemp2">(*)</td>
                                        </tr>
                                        <tr>
                                            <td class="rowemp">Giới tính:</td>
                                            <td class="rowemp1">
                                                <h:selectOneMenu value="#{employeeController.emp.gender}" id="gioitinh" class="chonadd" pt:required="" >                                                 
                                                    <f:selectItem itemValue="0" itemLabel="Nam"/> 
                                                    <f:selectItem itemValue="1" itemLabel="Nữ" />                                           
                                                </h:selectOneMenu>
                                            </td>
                                            <td class="rowemp2">(*)</td>
                                        </tr>
                                        <tr>
                                            <td class="rowemp">Quốc tịch:</td>
                                            <td class="rowemp1">
                                                <h:selectOneMenu value="${employeeController.emp.nationality}" id="quoctich" class="chonadd" pt:required="" >                                                 
                                                    <f:selectItem itemValue="" itemLabel="---Chọn một quốc gia---"/> 
                                                    <f:selectItems value="#{constantsController.countries}" var="c" itemValue="#{c}" itemLabel="#{c}" />                                           
                                                </h:selectOneMenu>
                                            </td>
                                            <td class="rowemp2">(*)</td>
                                        </tr>
                                        <tr>
                                            <td class="rowemp">Trình độ văn hóa:</td>
                                            <td class="rowemp1">
                                                <h:selectOneMenu value="${employeeController.emp.lyteracy}" id="tdhv" class="chonadd" pt:required="" >                                                 
                                                    <f:selectItem itemValue="" itemLabel="---Chọn một trình độ học vấn---"/> 
                                                    <f:selectItems value="#{constantsController.EQ}" var="c" itemValue="#{c}" itemLabel="#{c}" />                                           
                                                </h:selectOneMenu>   
                                            </td>
                                            <td class="rowemp2">(*)</td>
                                        </tr>
                                    </table>                
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <table class="tblemp">
                                        <tr>
                                            <td colspan="3">
                                                <p style="margin: 10px" align="center"><b>Vị trí trong làm việc</b></p>

                                            </td>  

                                        </tr>
                                        <tr>
                                            <td class="rowemp">Công ty:</td>
                                            <td class="rowemp1">
                                                <h:selectOneMenu value="#{employeeController.posi.com_id}" id="txtCongTy" class="chonadd"  pt:required="">
                                                    <f:selectItem itemLabel="Công ty cổ phần iNet"  itemValue="1"/>    
                                                </h:selectOneMenu> 

                                            </td>
                                            <td class="rowemp2"></td>
                                        </tr>
                                        <tr>
                                            <td class="rowemp">Chức vụ:</td>
                                            <td class="rowemp1">



                                                <h:selectOneMenu value="#{employeeController.posi.com_position}" id="txtcVu" class="chonadd">
                                                    <f:selectItem itemLabel="---Chọn chức vụ---" /> 
                                                    <f:selectItem itemLabel="Tổng giám đốc" itemValue="Tổng giám đốc" />
                                                    <f:selectItem itemLabel="Phó Tổng giám đốc" itemValue="Phó Tổng giám đốc" />

                                                </h:selectOneMenu> 
                                            </td>
                                            <td class="rowemp2"></td>
                                        </tr>
                                        <tr>
                                            <td class="rowemp">Trung tâm:</td>
                                            <td class="rowemp1">
                                                <h:selectOneMenu value="#{employeeController.posi.branch_id}" id="txtTrungTam" class="chonadd">
                                                    <f:selectItem itemLabel="---Chọn một trung tâm---" itemValue=""/> 
                                                    <f:selectItems value="#{branchController.listBranch}" var="b" itemLabel="#{b.branch_name}" itemValue="#{b.branch_id}" />

                                                </h:selectOneMenu> 

                                            </td>
                                            <td class="rowemp2"></td>
                                        </tr>
                                        <tr>
                                            <td class="rowemp">Chức vụ:</td>
                                            <td class="rowemp1">


                                                <h:selectOneMenu value="#{employeeController.posi.branch_position}" id="txtcVuTT" class="chonadd"  >

                                                    <f:selectItem itemLabel="---Chọn chức vụ---" itemValue=""/> 
                                                    <f:selectItem itemLabel="Giám đốc trung tâm" itemValue="Giám đốc trung tâm" />
                                                </h:selectOneMenu>
                                            </td>
                                            <td class="rowemp2"></td>
                                        </tr>
                                        <tr>
                                            <td class="rowemp">Phòng ban:</td>
                                            <td class="rowemp1">
                                                <h:selectOneMenu value="#{employeeController.posi.dep_id}" id="txtPhongBan" class="chonadd"> 
                                                    <f:selectItem itemLabel="---Chọn 1 phòng ban---"/>
                                                    <f:selectItems value="#{departmentController.lstDepartment}" var="d" itemValue="#{d.dep_id}" itemLabel="#{d.dep_name}" />
                                                </h:selectOneMenu>
                                            </td>
                                            <td class="rowemp2"></td>
                                        </tr>
                                        <tr>
                                            <td class="rowemp">Chức vụ:</td>
                                            <td class="rowemp1">



                                                <h:selectOneMenu value="#{employeeController.posi.dep_position}" id="txtcVuPB" class="chonadd">

                                                    <f:selectItem itemLabel="---Chọn chức vụ---"/> 
                                                    <f:selectItem itemLabel="Trưởng Phòng" itemValue="Trưởng Phòng" />
                                                    <f:selectItem itemLabel="Nhân viên" itemValue="Nhân viên"/>
                                                </h:selectOneMenu>
                                            </td>
                                            <td class="rowemp2"></td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <table class="tblemp">
                                        <tr>
                                            <td colspan="3">
                                                <p style="margin: 10px" align="center"><b>Tài khoản hệ thống </b></p>  
                                            </td>  

                                        </tr>                                  
                                        <tr>
                                            <td class="rowemp">Tên đăng nhập:</td>
                                            <td class="rowemp1">
                                                <h:inputText value="#{employeeController.emp.acc_name}" class="inputadd" id="txtusername" 
                                                             pt:placeholder="Tên đăng nhập" 
                                                             pt:pattern="[a-zA-Z0-9\\_\\.]{6,}" 

                                                             pt:required=""/>
                                            </td>
                                            <td class="rowemp2">(*)</td>
                                        </tr>
                                        <tr>
                                            <td class="rowemp">Mật khẩu:</td>
                                            <td class="rowemp1">
                                                <h:inputSecret value="#{employeeController.emp.password}" class="inputadd" 
                                                               id="txtpassword" pt:pattern="[a-zA-Z0-9]{8,50}"
                                                               pt:placeholder="Mật khẩu" pt:required=""/>
                                            </td>
                                            <td class="rowemp2">(*)</td>
                                        </tr>
                                        <tr>
                                            <td class="rowemp">Quyền hạn:</td>
                                            <td class="rowemp1">
                                                <h:selectOneMenu value="#{employeeController.emp.roll}" id="txtquyen" class="chonadd"  pt:required="">
                                                    <f:selectItem itemLabel="---Chọn một quyền---" itemValue=""/> 
                                                    <f:selectItem itemLabel="Quản lý" itemValue="1" />
                                                    <f:selectItem itemLabel="Trưởng phòng" itemValue="2" />
                                                    <f:selectItem itemLabel="Nhân viên" itemValue="3" />
                                                </h:selectOneMenu> 
                                            </td>
                                            <td class="rowemp2">(*)</td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                            <tr>                        
                                <td>
                                    <table class="tblemp1">
                                        <tr>
                                            <td></td>
                                            <td class="btnaddemp">
                                                <h:commandButton styleClass="btnSubmid" value="Thêm " action="#{employeeController.addEmployess()}"/>
                                                <h:commandButton styleClass="btnSubmid" value="Làm lại" type="reset"/>
                                            </td>
                                            <td></td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        </table>
                    </div>
                    <br/>
                    <br/>                      
                </div>

                <!-- end dội dung-->
            </div>
            <!--Footer-->
            <ui:include src="/resources/template/footer.xhtml"/>
            <!--end footer-->

        </h:form>
    </h:body>
</html>

